# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1125 -> 1.1126 # drivers/char/mem.c 1.41 -> 1.42 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/06/10 davidm@tiger.hpl.hp.com 1.1126 # Don't try to support uncached accesses via read()/write(). # -------------------------------------------- # diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c --- a/drivers/char/mem.c Wed Jun 11 00:38:03 2003 +++ b/drivers/char/mem.c Wed Jun 11 00:38:03 2003 @@ -105,39 +105,6 @@ } -static ssize_t do_write_mmio(struct file * file, void *p, unsigned long realp, - const char * buf, size_t count, loff_t *ppos) -{ - ssize_t written; - char byte; - size_t i; - - /* this is slow but nobody cares... */ - - written = 0; -#if defined(__sparc__) || (defined(__mc68000__) && defined(CONFIG_MMU)) - /* we don't have page 0 mapped on sparc and m68k.. */ - if (realp < PAGE_SIZE) { - unsigned long sz = PAGE_SIZE-realp; - if (sz > count) sz = count; - /* Hmm. Do something? */ - buf+=sz; - p+=sz; - count-=sz; - written+=sz; - } -#endif - for (i = 0; i < count; ++i) { - if (get_user(byte, buf + i)) - return -EFAULT; - writeb(byte, p + i); - } - written += count; - *ppos += written;; - return written; -} - - /* * This funcion reads the *physical* memory. The f_pos points directly to the * memory location. @@ -148,7 +115,6 @@ unsigned long p = *ppos; unsigned long end_mem; ssize_t read; - void *addr; end_mem = __pa(high_memory); if (p >= end_mem) @@ -172,22 +138,8 @@ } } #endif - if (uncached_access(file, (unsigned long) p)) { - char byte; - size_t i; - - if (!(addr = ioremap(p, count))) - return -EFAULT; - /* this is slow but nobody cares... */ - for (i = 0; i < count; ++i) { - byte = readb(addr + i); - if (put_user(byte, buf + i)) - return -EFAULT; - } - iounmap(addr); - } else - if (copy_to_user(buf, __va(p), count)) - return -EFAULT; + if (copy_to_user(buf, __va(p), count)) + return -EFAULT; read += count; *ppos += read; return read; @@ -198,30 +150,23 @@ { unsigned long p = *ppos; unsigned long end_mem; - ssize_t ret; - void *addr; end_mem = __pa(high_memory); if (p >= end_mem) return 0; if (count > end_mem - p) count = end_mem - p; - if (uncached_access(file, (unsigned long) p)) { - if (!(addr = ioremap(p, count))) - return -EFAULT; - ret = do_write_mmio(file, addr, p, buf, count, ppos); - iounmap(addr); - } else - ret = do_write_mem(file, __va(p), p, buf, count, ppos); - return ret; + return do_write_mem(file, __va(p), p, buf, count, ppos); } static int mmap_mem(struct file * file, struct vm_area_struct * vma) { unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; + int uncached; + uncached = uncached_access(file, offset); #ifdef pgprot_noncached - if (uncached_access(file, offset)) + if (uncached) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); #endif @@ -231,7 +176,7 @@ /* * Don't dump addresses that are not real memory to a core file. */ - if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC)) + if (uncached) vma->vm_flags |= VM_IO; if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,